package MyAdmin.Controller;


import MyFramePro.Domain.ResponseResult;
import MyFramePro.Domain.Vo.LinkVo;
import MyFramePro.Service.Impl.LinkServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/content/link")
public class LinkController {

    @Resource
    private LinkServiceImpl linkService;

    /**
     * 这里是友链的分页查询功能
     */
    @GetMapping(value = "/list")
    public ResponseResult selectLinkPageList(Integer pageNum,Integer pageSize,String name,String status){

        return linkService.selectLinkPageList(pageNum,pageSize,name,status);
    }


    /**
     * 这里为新增友链的功能
     */
    @PostMapping
    public ResponseResult addLinks(@RequestBody LinkVo linkVo){

        return linkService.addLinks(linkVo);
    }


    /**
     * 修改友链————查询友链信息功能
     */
    @GetMapping("{id}")
    public ResponseResult selectLinkInfo(@PathVariable("id") Long id){

        return linkService.selectLinkInfo(id);
    }


    /**
     * 这里是修改友链的功能
     */
    @PutMapping
    public ResponseResult updateLink(@RequestBody LinkVo linkVo){

        return linkService.updateLink(linkVo);
    }


    /**
     * 这里是删除友链的功能
     */
    @DeleteMapping("{id}")
    public ResponseResult deleteLink(@PathVariable("id") Long id){

        return linkService.deleteLink(id);
    }


    /**
     * 这里是更改审核状态的功能
     */
    @PutMapping(value = "/changeLinkStatus")
    public ResponseResult changeLinkStatus(@RequestBody LinkVo linkVo){

        return linkService.changeLinkStatus(linkVo);
    }

}
